<?php

namespace App\Api;

use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Http\Request;
use Auth;

class UserController extends Controller
{
    public function __construct()
    {
        $this->middleware('auth:sanctum');
    }

    public function info()
    {
        return Auth::user();
    }

    public function update(Request $request, User $user)
    {
        $request->validate([
            'name' => 'required',
            'email' => ['required'],
            'mobile' => ['required']
        ]);
        $user->update($request->input());
        return $this->message('修改成功');

    }
}
